home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Utilities / Interfaces / WinUtils.h < prev   
Encoding:
C/C++ Source or Header  |  1996-04-22  |  2.5 KB  |  97 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        WinUtils.h
  3.  
  4.     Contains:    Utility functions for getting persistent window properties from a frame
  5.  
  6.     Owned by:    Richard Rodseth
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #ifndef _WINUTILS_
  13. #define _WINUTILS_
  14.  
  15.  
  16. #ifndef _ODTYPES_
  17. #include <ODTypes.h>
  18. #endif
  19.  
  20. //==============================================================================
  21. // Theory of operation
  22. //==============================================================================
  23.  
  24. /*
  25.  
  26. These functions allow a part editor to obtain the properties necessary to create
  27. a window, from the storage annotation on a root frame. BeginGetWindowProperties
  28. returns kODTrue if the annotation exists, and fills in the "properties" struct.
  29. EndGetWindProperties releases the sourceFrame field of the struct.
  30.  
  31. Usage:
  32.  
  33.     WindowProperties props;
  34.     ODWindow* window = kODNULL;
  35.     
  36.     if (BeginGetWindowProperties(ev, frame, &props))
  37.     {
  38.  
  39.         ODPlatformWindow platformWindow = NewCWindow(kODNULL, &(props.boundsRect), props.title, 
  40.                     kODFalse, props.procID, (WindowPtr)-1L, props.hasCloseBox, props.refCon);
  41.         
  42.         window =  fSession->GetWindowState(ev)->RegisterWindowForFrame(ev, platformWindow, 
  43.                                                         frame,
  44.                                                          props.isRootWindow,    // Keeps draft open
  45.                                                          kODTrue,    // Is resizable
  46.                                                          kODFalse,    // Is floating
  47.                                                          kODTrue,    // shouldSave
  48.                                                          props.sourceFrame);
  49.         EndGetWindowProperties(ev, &props); // Release source frame
  50.     }
  51.  
  52. */
  53.  
  54. //==============================================================================
  55. // Classes used by this interface
  56. //==============================================================================
  57.  
  58. struct    ODFrame;
  59.  
  60. //==============================================================================
  61. // Function prototypes
  62. //==============================================================================
  63.  
  64. struct WindowProperties
  65. {
  66.     Rect boundsRect;
  67.     Str255 title;
  68.     ODSShort  procID;
  69.     ODBoolean hasCloseBox;
  70.     ODSLong   refCon;
  71.     ODBoolean wasVisible;
  72.     ODBoolean isResizable;
  73.     ODBoolean isFloating;
  74.     ODBoolean isRootWindow;
  75.     ODBoolean shouldShowLinks;
  76.     ODFrame*  sourceFrame;
  77. };
  78.  
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82.  
  83. ODBoolean BeginGetWindowProperties(Environment* ev, ODFrame* frame, WindowProperties* properties);
  84.  
  85.     // Obtains window properties from the storage unit referred to in the frame's
  86.     // kODPropWindowProperties.
  87.  
  88. void EndGetWindowProperties(Environment* ev, WindowProperties* properties);
  89.  
  90.     // Releases the source frame
  91.  
  92. #ifdef __cplusplus
  93. } /* extern "C" */
  94. #endif
  95.  
  96. #endif // _WINUTILS_
  97.